
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace ShopOnline.DAL
{
	public abstract class _PageBanners : SqlClientEntity
	{
		public _PageBanners()
		{
			this.QuerySource = "PageBanners";
			this.MappingName = "PageBanners";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_PageBannersLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_PageBannersLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter FileName
			{
				get
				{
					return new SqlParameter("@FileName", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter Title
			{
				get
				{
					return new SqlParameter("@Title", SqlDbType.NVarChar, 100);
				}
			}
			
			public static SqlParameter Description
			{
				get
				{
					return new SqlParameter("@Description", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter Active
			{
				get
				{
					return new SqlParameter("@Active", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter URL
			{
				get
				{
					return new SqlParameter("@URL", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter Page
			{
				get
				{
					return new SqlParameter("@Page", SqlDbType.NVarChar, 100);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string FileName = "FileName";
            public const string Title = "Title";
            public const string Description = "Description";
            public const string Active = "Active";
            public const string URL = "URL";
            public const string Page = "Page";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _PageBanners.PropertyNames.ID;
					ht[FileName] = _PageBanners.PropertyNames.FileName;
					ht[Title] = _PageBanners.PropertyNames.Title;
					ht[Description] = _PageBanners.PropertyNames.Description;
					ht[Active] = _PageBanners.PropertyNames.Active;
					ht[URL] = _PageBanners.PropertyNames.URL;
					ht[Page] = _PageBanners.PropertyNames.Page;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string FileName = "FileName";
            public const string Title = "Title";
            public const string Description = "Description";
            public const string Active = "Active";
            public const string URL = "URL";
            public const string Page = "Page";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _PageBanners.ColumnNames.ID;
					ht[FileName] = _PageBanners.ColumnNames.FileName;
					ht[Title] = _PageBanners.ColumnNames.Title;
					ht[Description] = _PageBanners.ColumnNames.Description;
					ht[Active] = _PageBanners.ColumnNames.Active;
					ht[URL] = _PageBanners.ColumnNames.URL;
					ht[Page] = _PageBanners.ColumnNames.Page;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string FileName = "s_FileName";
            public const string Title = "s_Title";
            public const string Description = "s_Description";
            public const string Active = "s_Active";
            public const string URL = "s_URL";
            public const string Page = "s_Page";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ID
	    {
			get
	        {
				return base.Getint(ColumnNames.ID);
			}
			set
	        {
				base.Setint(ColumnNames.ID, value);
			}
		}

		public virtual string FileName
	    {
			get
	        {
				return base.Getstring(ColumnNames.FileName);
			}
			set
	        {
				base.Setstring(ColumnNames.FileName, value);
			}
		}

		public virtual string Title
	    {
			get
	        {
				return base.Getstring(ColumnNames.Title);
			}
			set
	        {
				base.Setstring(ColumnNames.Title, value);
			}
		}

		public virtual string Description
	    {
			get
	        {
				return base.Getstring(ColumnNames.Description);
			}
			set
	        {
				base.Setstring(ColumnNames.Description, value);
			}
		}

		public virtual bool Active
	    {
			get
	        {
				return base.Getbool(ColumnNames.Active);
			}
			set
	        {
				base.Setbool(ColumnNames.Active, value);
			}
		}

		public virtual string URL
	    {
			get
	        {
				return base.Getstring(ColumnNames.URL);
			}
			set
	        {
				base.Setstring(ColumnNames.URL, value);
			}
		}

		public virtual string Page
	    {
			get
	        {
				return base.Getstring(ColumnNames.Page);
			}
			set
	        {
				base.Setstring(ColumnNames.Page, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetintAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetintAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_FileName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.FileName) ? string.Empty : base.GetstringAsString(ColumnNames.FileName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.FileName);
				else
					this.FileName = base.SetstringAsString(ColumnNames.FileName, value);
			}
		}

		public virtual string s_Title
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Title) ? string.Empty : base.GetstringAsString(ColumnNames.Title);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Title);
				else
					this.Title = base.SetstringAsString(ColumnNames.Title, value);
			}
		}

		public virtual string s_Description
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Description) ? string.Empty : base.GetstringAsString(ColumnNames.Description);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Description);
				else
					this.Description = base.SetstringAsString(ColumnNames.Description, value);
			}
		}

		public virtual string s_Active
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Active) ? string.Empty : base.GetboolAsString(ColumnNames.Active);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Active);
				else
					this.Active = base.SetboolAsString(ColumnNames.Active, value);
			}
		}

		public virtual string s_URL
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.URL) ? string.Empty : base.GetstringAsString(ColumnNames.URL);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.URL);
				else
					this.URL = base.SetstringAsString(ColumnNames.URL, value);
			}
		}

		public virtual string s_Page
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Page) ? string.Empty : base.GetstringAsString(ColumnNames.Page);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Page);
				else
					this.Page = base.SetstringAsString(ColumnNames.Page, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter FileName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.FileName, Parameters.FileName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Title
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Title, Parameters.Title);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Description
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Description, Parameters.Description);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Active
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Active, Parameters.Active);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter URL
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.URL, Parameters.URL);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Page
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Page, Parameters.Page);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter FileName
		    {
				get
		        {
					if(_FileName_W == null)
	        	    {
						_FileName_W = TearOff.FileName;
					}
					return _FileName_W;
				}
			}

			public WhereParameter Title
		    {
				get
		        {
					if(_Title_W == null)
	        	    {
						_Title_W = TearOff.Title;
					}
					return _Title_W;
				}
			}

			public WhereParameter Description
		    {
				get
		        {
					if(_Description_W == null)
	        	    {
						_Description_W = TearOff.Description;
					}
					return _Description_W;
				}
			}

			public WhereParameter Active
		    {
				get
		        {
					if(_Active_W == null)
	        	    {
						_Active_W = TearOff.Active;
					}
					return _Active_W;
				}
			}

			public WhereParameter URL
		    {
				get
		        {
					if(_URL_W == null)
	        	    {
						_URL_W = TearOff.URL;
					}
					return _URL_W;
				}
			}

			public WhereParameter Page
		    {
				get
		        {
					if(_Page_W == null)
	        	    {
						_Page_W = TearOff.Page;
					}
					return _Page_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _FileName_W = null;
			private WhereParameter _Title_W = null;
			private WhereParameter _Description_W = null;
			private WhereParameter _Active_W = null;
			private WhereParameter _URL_W = null;
			private WhereParameter _Page_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_FileName_W = null;
				_Title_W = null;
				_Description_W = null;
				_Active_W = null;
				_URL_W = null;
				_Page_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter FileName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.FileName, Parameters.FileName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Title
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Title, Parameters.Title);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Description
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Description, Parameters.Description);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Active
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Active, Parameters.Active);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter URL
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.URL, Parameters.URL);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Page
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Page, Parameters.Page);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter FileName
		    {
				get
		        {
					if(_FileName_W == null)
	        	    {
						_FileName_W = TearOff.FileName;
					}
					return _FileName_W;
				}
			}

			public AggregateParameter Title
		    {
				get
		        {
					if(_Title_W == null)
	        	    {
						_Title_W = TearOff.Title;
					}
					return _Title_W;
				}
			}

			public AggregateParameter Description
		    {
				get
		        {
					if(_Description_W == null)
	        	    {
						_Description_W = TearOff.Description;
					}
					return _Description_W;
				}
			}

			public AggregateParameter Active
		    {
				get
		        {
					if(_Active_W == null)
	        	    {
						_Active_W = TearOff.Active;
					}
					return _Active_W;
				}
			}

			public AggregateParameter URL
		    {
				get
		        {
					if(_URL_W == null)
	        	    {
						_URL_W = TearOff.URL;
					}
					return _URL_W;
				}
			}

			public AggregateParameter Page
		    {
				get
		        {
					if(_Page_W == null)
	        	    {
						_Page_W = TearOff.Page;
					}
					return _Page_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _FileName_W = null;
			private AggregateParameter _Title_W = null;
			private AggregateParameter _Description_W = null;
			private AggregateParameter _Active_W = null;
			private AggregateParameter _URL_W = null;
			private AggregateParameter _Page_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_FileName_W = null;
				_Title_W = null;
				_Description_W = null;
				_Active_W = null;
				_URL_W = null;
				_Page_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_PageBannersInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.ID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_PageBannersUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_PageBannersDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.FileName);
			p.SourceColumn = ColumnNames.FileName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Title);
			p.SourceColumn = ColumnNames.Title;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Description);
			p.SourceColumn = ColumnNames.Description;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Active);
			p.SourceColumn = ColumnNames.Active;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.URL);
			p.SourceColumn = ColumnNames.URL;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Page);
			p.SourceColumn = ColumnNames.Page;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
